<template>
  <div class="bid-info">
    <h3>
      异常终止
    </h3>
    <div class="info-div">
      <div class="cleardix panel_end">
        <time-line :showInfo="showInfo" :url="infourl" :formData="formData" ref="tim"></time-line>
        <el-button v-if="isShow" class="fr fr_right" icon="el-icon-success" type="success" @click="againInquiry">再次询价</el-button>
        <el-button class="fr fr_right" icon="el-icon-view" type="primary"@click.stop="() => {$refs.tim.toggleDiolag()}">查看日志</el-button>
      </div>
      <div class="cleardix panel_end">
        <h1 style="text-align:center;font-weight: bold;font-size:20px">该单据未异常终止 </h1>
      </div>
      <el-form :model="form" v-if="isShow">
        <el-row class="el_row_bottom">
          <el-col :span="6" class="col_label">异常单据终止时间</el-col>
          <el-col :span="6" class="col_view">{{form.closeTime}}</el-col>
          <el-col :span="6" class="col_label">操作人</el-col>
          <el-col :span="6" class="col_view">{{form.closeUserId}}</el-col>
        </el-row>
        <el-row class="el_row_bottom">
          <el-col :span="6" class="col_label">
            <div class="improveRequirement improveRequirement_left">异常终止原因</div>
          </el-col>
          <el-col :span="18" class="col_view">
            <div class="Requirement">
              {{form.closeRemark}}
            </div>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>
<script>
  import timeLine from '@/components/timeline.vue';
  export default {
    components:{
      timeLine
    },    
    data() {
      return {
        //业务日志
        showInfo: true,
        infourl: this.lib.config.host.system + '/system/log/getList',
        formData: {
          moduleCode: 'RFQ',
          businessId: this.$route.query.id
        },
        //业务日志          
        isShow:true,
        form: {}
      };
    },
    created() {
      this.init()
    },
    methods: {
      //再次询价
      againInquiry() {
        this.$confirm('再次询价将会复制这条询价数据，形成新的询价单!确定要执行此操作吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.axios.post(this.lib.config.host.rfq + "/ctmgt/rfq/enquiry/finish/rfqCopy/" + this.$route.query.id)
            .then((response) => {
              //this.$refs['tableExt'].refreshTable();
              if (response.data.success) {
                this.$message({
                  type: 'success',
                  message: '成功创建新的询价单，请进入【创建询价】或刷新询价单列表数据查看!'
                });
              }
            })
            .catch((error) => {
              console.log(error)
            });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消再次询价'
          });
        });
      },      
      closeDialog(){
        this.showInfo=false;
      },       
      init(){
        this.axios.post(this.lib.config.host.rfq + '/ctmgt/rfq/enquiry/finish/over/query/' + this.$route.query.id)
          .then((response) => {
            if(response.data==''){
              this.isShow=false;
            }else{
              this.isShow=true;
            }
          })
          .catch(function (error) {
            console.log(error);
          });       
      }
    }
  }

</script>
